unit oFramePedestrian;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 
  Dialogs, StdCtrls, oProcessItem, oProcessObjects,oProcessObjectConstants,
  oManager, ExtCtrls;

type
  TfPedestrian = class(TFrame)
    txtName: TLabeledEdit;
    txtCrowdTightning: TLabeledEdit;
    txtDiameter: TLabeledEdit;
    txtAvgVelocity: TLabeledEdit;
    txtMaxVelocity: TLabeledEdit;
    txtMaxAcceleration: TLabeledEdit;
    txtView: TLabeledEdit;
    btnOK: TButton;
    btnEdit: TButton;
    bntCancel: TButton;
    txtGainTightning: TLabeledEdit;
    txtBarierTightning: TLabeledEdit;
    procedure txtDiameterExit(Sender: TObject);
  private
    aMaster : TManager;
    { Private declarations }
  public
    { Public declarations }
    property Master: TManager read aMaster write aMaster;
    constructor Create(paMaster : TManager);
  end;

implementation

{$R *.dfm}

uses
  oMasterManager;

resourcestring tooSmallDiameter = 'diameter too low';

constructor TfPedestrian.Create(paMaster: TManager);
begin
  aMaster := paMaster;
end;

procedure TfPedestrian.txtDiameterExit(Sender: TObject);
var
  MinCell: Real;
  Diameter: Real;
begin
  try
    Diameter := StrToFloat(txtDiameter.Text);
    MinCell := (aMaster as tMasterManager).SceneManager.Scene.getMinimumCellSize;
    if Diameter < MinCell then
      begin
        MessageDlg(tooSmallDiameter,mtError,[mbOK],0);
        txtDiameter.SetFocus;
      end;
  except
  end;
end;

end.
